package com.maxjay.system.core.interceptor;

import com.maxjay.system.web.controller.struts.BaseController;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;

/**
 * 状态拦截器
 * 
 * @author Administrator
 * 
 */
public class ViewStateInterceptor extends MethodFilterInterceptor {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Override
	protected String doIntercept(ActionInvocation actionInvocation) throws Exception {
		Object obj = actionInvocation.getAction();
		String result = "";
		if (BaseController.class.isAssignableFrom(obj.getClass())) {
//			BaseController baseController = (BaseController) obj;
			//baseController.configPropertiesInViewState();
			//baseController.readViewState();
			result = actionInvocation.invoke();
			//baseController.resetViewState();
		} else {
			result = actionInvocation.invoke();
		}
		return result;
	}

}
